package tech.edwardvan.quartzdemo.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import tech.edwardvan.quartzdemo.common.ServerResponse;


/**
 * 全局异常处理器
 *
 * @author EdwardVan
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionConfig {

    @ExceptionHandler(Exception.class)
    public ServerResponse globalError(Exception e) {
        e.printStackTrace();
        return ServerResponse.errorMessage(e.getMessage());
    }
}
